<template>
  <div>
    <table class="table" border="1" style="border-collapse: collapse;width: 100%;text-align: center;" bordercolor="#dddddd">
        <!--个人基本信息-->
        <tr>
          <td>姓名</td>
          <td style="height:40px;width: 50px;">{{previewData.playerInfo.name}}</td>
          <td>出生年月</td>
          <td style="height:40px">{{previewData.playerInfo.birth}}</td>
          <td>民族</td>
          <td style="height:40px">{{previewData.playerInfo.nation}}</td>
          <td>身高</td>
          <td style="height:40px;">{{previewData.playerInfo.height}}</td>
          <td>省注册号</td>
          <td style="height:40px;min-width: 100px;">{{previewData.playerInfo.schoolRoll}}</td>
        </tr>
        <tr>
          <td>性别</td>
          <td style="height:40px">{{previewData.playerInfo.gender}}</td>
          <td>所在单位</td>
          <td style="height:40px">{{previewData.playerInfo.org}}</td>
          <td>籍贯</td>
          <td style="height:40px">{{previewData.playerInfo.address}}</td>
          <td>体重</td>
          <td style="height:40px">{{previewData.playerInfo.weight}}</td>
          <td>身份证号</td>
          <td style="height:40px">{{previewData.playerInfo.idNo}}</td>
        </tr>
        <tr>
          <td>就读年级</td>
          <td style="height:40px">{{previewData.playerInfo.grade}}</td>
          <td>联系电话</td>
          <td style="height:40px">{{previewData.playerInfo.phone}}</td>
          <td>教练姓名</td>
          <td style="height:40px">{{previewData.playerInfo.coach}}</td>
          <td>骨龄</td>
          <td style="height:40px">{{previewData.playerInfo.boneAge}}</td>
          <td>户口所在地</td>
          <td style="height:40px">{{previewData.playerInfo.address}}</td>
        </tr>
        <!--表头-->
          <tr style="height: 5px">
            <td colspan="2" rowspan="2">评价指标</td>
            <td rowspan="2">成绩</td>
            <td colspan="3">测试得分</td>
            <td rowspan="2">最终得分</td>
            <td rowspan="2">最终评价</td>
            <td rowspan="2" colspan="2">备注</td>
          </tr>
          <tr style="height: 5px">
            <td>左得分</td>
            <td>右得分</td>
            <td>确认得分</td>
          </tr>

    <!--fms 动作质量-->
      <tr>
        <td rowspan="7">动<br />作<br />质<br />量<br />F<br />M<br />S</td>
        <td>上举木棒深蹲</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'fms',0)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>
      <tr>
        <td>跨栏架</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'fms',1)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>
      <tr>
        <td>背后手持木棒弓步下蹲</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'fms',2)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>
      <tr>
        <td>仰卧举腿</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'fms',3)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>
      <tr>
        <td>肩关节灵活度</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'fms',4)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>
      <tr>
        <td>俯卧撑</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'fms',5)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>
      <tr>
        <td>旋转稳定性</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'fms',6)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>

    <!--综合力量-->
      <tr>
        <td rowspan="4">综<br />合<br />力<br />量</td>
        <td rowspan="2">土耳其推举</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'synthesized',0)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>
      <tr>
        <td style="height:40px">{{currentList(previewData,'synthesized',0,'rightBang-rightTimes')}}</td>
      </tr>
      <tr>
        <td>卧推</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'synthesized',1)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>
      <tr>
        <td>负重深蹲</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'synthesized',2)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>


    <!--上肢爆发力-->
      <tr>
        <td rowspan="4">上<br />肢<br />爆<br />发<br />力</td>
        <td rowspan="3">跪式推实心球</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'upper',0)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>
      <tr>
        <td style="height:40px">{{currentList(previewData,'upper',0,'secondResult')}}</td>
      </tr>
      <tr>
        <td style="height:40px">{{currentList(previewData,'upper',0,'thirdResult')}}</td>
      </tr>
      <tr>
        <td>高翻</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'upper',1)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>


    <!--局部肌肉力量-->
      <tr>
        <td rowspan="2">局<br />部<br />肌<br />肉<br />力<br />量</td>
        <td>一分钟仰卧起坐</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'partly',0)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>

      <tr>
        <td>引体向上</td>
        <td v-for="item,index in currentList(previewData,'partly',1)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>

    <!--耐力-->
      <tr>
        <td rowspan="3">耐<br />力</td>
        <td>1600米</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'endurance',0)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>

      <tr>
        <td>1000米/800米</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'endurance',1)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>

      <tr>
        <td>300码折返</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'endurance',2)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>

    <!--协调能力-->
      <tr>
        <td rowspan="2">协<br />调<br />能<br />力</td>
        <td>一分钟跳绳</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'balance',0)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>

      <tr>
        <td>视、听觉反应时</td>
        <td style="height:40px" v-for="item,index in currentList(previewData,'balance',1)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
      </tr>

      <!--加速能力-->
        <tr>
          <td rowspan="4">加<br />速<br />能<br />力</td>
          <td rowspan="2">10码</td>
          <td style="height:40px" v-for="item,index in currentList(previewData,'acceleration',0)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
        </tr>
        <tr>
          <td style="height:40px">{{currentList(previewData,'acceleration',0,'rightFootFront')}}</td>
        </tr>
        <tr>
          <td rowspan="2">40码</td>
          <td style="height:40px" v-for="item,index in currentList(previewData,'acceleration',1)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
        </tr>
        <tr>
          <td style="height:40px">{{currentList(previewData,'acceleration',1,'rightFootFront')}}</td>
        </tr>



        <!--下肢爆发力-->
        <tr>
          <td rowspan="7">下<br />肢<br />爆<br />发<br />力</td>
          <td rowspan="2">静蹲跳</td>
          <td style="height:40px" v-for="item,index in currentList(previewData,'lower',0)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
        </tr>
        <tr>
          <td style="height:40px">{{currentList(previewData,'lower',0,'secondResult')}}</td>
        </tr>
        <tr>
          <td rowspan="2">快速下蹲跳</td>
          <td style="height:40px" v-for="item,index in currentList(previewData,'lower',1)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
        </tr>
        <tr>
          <td style="height:40px">{{currentList(previewData,'lower',1,'secondResult')}}</td>
        </tr>
        <tr>
          <td>差值()派生指数</td>
          <td style="height:40px" v-for="item,index in currentList(previewData,'lower',2)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
        </tr>
        <tr>
          <td rowspan="2">立定跳远</td>
          <td style="height:40px" v-for="item,index in currentList(previewData,'lower',3)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
        </tr>
        <tr>
          <td style="height:40px">{{currentList(previewData,'lower',3,'secondResult')}}</td>
        </tr>


      <!--灵敏性-->
        <tr>
          <td rowspan="6">灵<br />敏<br />性</td>
          <td rowspan="2">T测试</td>
          <td style="height:40px" v-for="item,index in currentList(previewData,'sensitive',0)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
        </tr>
        <tr>
          <td style="height:40px">{{currentList(previewData,'sensitive',0,'secondResult')}}</td>
        </tr>

        <tr>
          <td rowspan="2">I测试</td>
          <td style="height:40px" v-for="item,index in currentList(previewData,'sensitive',1)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
        </tr>
        <tr>
          <td style="height:40px">{{currentList(previewData,'sensitive',1,'secondResult')}}</td>
        </tr>
        <tr>
          <td rowspan="2">5码-10码-5码测试</td>
          <td style="height:40px" v-for="item,index in currentList(previewData,'sensitive',2)" :rowspan="item.rowspan" :colspan="item.colspan">{{item.val}}</td>
        </tr>
        <tr>
          <td style="height:40px">{{currentList(previewData,'sensitive',2,'secondResult')}}</td>
        </tr>

        <tr>
          <td class="" colspan="6"></td>
          <td style="height:40px">{{previewData.finalScore}}</td>
          <td style="height:40px">{{previewData.finalValue}}</td>
          <td class="" colspan="2"></td>
        </tr>
      </table>
  </div>
</template>

<script>
  export default {
    props: ['previewData'],
    methods: {
      currentList(data,key,index,right) {
        var dict_previewOrder = {
          'fms-1': ['normalResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'fms-2': ['normalResult', 'leftScore', 'rightScore', 'ensureScore','memo'],
          'fms-3': ['normalResult', 'leftScore', 'rightScore', 'ensureScore','memo'],
          'fms-4': ['normalResult', 'leftScore', 'rightScore', 'ensureScore','memo'],
          'fms-5': ['normalResult', 'leftScore', 'rightScore', 'ensureScore','memo'],
          'fms-6': ['normalResult', 'leftScore', 'rightScore', 'ensureScore','memo'],
          'fms-7': ['normalResult', 'leftScore', 'rightScore', 'ensureScore','memo'],
          'synthesized-1': ['leftBang-leftTimes', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue', 'memo'],
          'synthesized-2': ['normalResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'synthesized-3': ['normalResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'upper-1': ['firstResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'upper-2': ['normalResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'partly-1': ['normalResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'partly-2': ['normalResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'endurance-1': ['normalResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'endurance-2': ['normalResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'endurance-3': ['normalResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'balance-1': ['normalResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'balance-2': ['normalResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'acceleration-1': ['leftFootFront', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'acceleration-2': ['leftFootFront', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'lower-1': ['firstResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'lower-2': ['firstResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'lower-3': ['normalResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'lower-4': ['firstResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'sensitive-1': ['firstResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'sensitive-2': ['firstResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
          'sensitive-3': ['firstResult', 'leftScore', 'rightScore', 'ensureScore', 'finalScore', 'finalValue','memo'],
        }
        let i = index + 1
        let previewOrder = dict_previewOrder[key+'-'+i]
        let arr = []
        if(data[key].length!=0 && data[key][index]){
          previewOrder.forEach(item=>{
            let obj = {}
            obj['val'] = data[key][index][item]&&data[key][index][item]!='-1'?data[key][index][item]:''
            if(item=='leftBang-leftTimes'){
              let keyArr = item.split('-')
              let a = data[key][index][keyArr[0]]&&data[key][index][keyArr[0]]!='-1'?data[key][index][keyArr[0]]:''
              let b = data[key][index][keyArr[1]]&&data[key][index][keyArr[1]]!='-1'?data[key][index][keyArr[1]]:''
              obj['val'] = a+'磅'+b+'次'
            }
            if(key=='fms' && (item=='finalValue' || item=='finalScore')){
              obj['rowspan'] = 7
            }

            if(key=='synthesized' && index==0 && item!='leftBang-leftTimes'){
              obj['rowspan'] = 2
            }

            if(key=='lower'&& index !=2 && item!='firstResult'){
              obj['rowspan'] = 2
            }

            if(key=='acceleration' && item!='leftFootFront'){
              obj['rowspan'] = 2
            }

            if(key=='upper' && index==0 && item!='firstResult'){
              obj['rowspan'] = 3
            }
            if(key=='sensitive' && item!='firstResult'){
              obj['rowspan'] = 2
            }
            if(item=='memo'){
              obj['colspan'] = 2
            }
            arr.push(obj)
          })
          if(right=='rightBang-rightTimes'){
            let keyArr = right.split('-')
            let a = data[key][index][keyArr[0]]&&data[key][index][keyArr[0]]!='-1'?data[key][index][keyArr[0]]:''
            let b = data[key][index][keyArr[1]]&&data[key][index][keyArr[1]]!='-1'?data[key][index][keyArr[1]]:''
            let str = a+'磅'+b+'次'
            return str
          }else if(right=='secondResult' || right=='thirdResult' || right=='rightFootFront' ){
            let str = data[key][index][right]&&data[key][index][right]!='-1'?data[key][index][right]:''
            return str
          }else{
            return arr
          }
        }else{
          previewOrder.forEach(item=>{
            let obj = {}
            obj['val'] = ''
            if(key=='fms' && (item=='finalValue' || item=='finalScore')){
              obj['rowspan'] = 7
            }

            if(key=='synthesized' && index==0 && item!='leftBang-leftTimes'){
              obj['rowspan'] = 2
            }
            if(key=='lower'  && index !=2 && item!='firstResult'){
              obj['rowspan'] = 2
            }
            if(key=='acceleration' && item!='leftFootFront'){
              obj['rowspan'] = 2
            }
            if(key=='upper' && index==0 && item!='firstResult'){
              obj['rowspan'] = 3
            }
            if(key=='sensitive' && item!='firstResult'){
              obj['rowspan'] = 2
            }
            if(item=='memo'){
              obj['colspan'] = 2
            }
            arr.push(obj)
          })
          if(right){
            return ''
          }else{
            return arr
          }
        }
      },
    }
  }
</script>

<style lang="scss" scoped>
</style>
